import CrmRelativeCell from '@/components/CreateCom/CrmRelativeCell'

const injectedData = (otherObjComs) => {
// 处理 CrmRelativeCell 相关
  const CrmRelativeCellData = otherObjComs['CrmRelativeCell']
  if (CrmRelativeCellData) {
    // ***注入组件***
    // const defaultComponents = CrmRelativeCell.components || {}
    // CrmRelativeCell.components = {
    //   ...defaultComponents,
    //   ...CrmRelativeCellData.components
    // }

    // ***注入data***
    const defaultData = CrmRelativeCell.data()
    const dataKeys = ['defaultApi', 'defaultNameKey', 'defaultValueKey']
    dataKeys.forEach(key => {
      defaultData[key] = {
        ...defaultData[key],
        ...CrmRelativeCellData.data[key]
      }
    }
    )
    CrmRelativeCell.data = function() {
      return defaultData
    }
  }
}

export default {
  injectedData
}
